<%-- 
    Document   : index
    Created on : Nov 10, 2013, 12:45:15 PM
    Author     : Lucas
--%>
<%@page import="java.io.File"%>
<%
    File instalado = new File(application.getRealPath("/") + "instalado.txt");
    if (instalado.exists()) {
%>
<jsp:include page="header.jsp"/>
<%
    String url = null;
    String url2 = null;
    if (request.getParameter("pagina") != null) {
        url = application.getRealPath("") + "/pags/" + request.getParameter("pagina") + ".jsp";
        url2 = "pags/" + request.getParameter("pagina") + ".jsp";

        File file = new File(url);
        if (file.exists()) {
%>
<jsp:include page="<%=url2%>"/>
<%
} else {
%>
<jsp:include page="pags/erro.jsp"/>
<%                }
} else if (request.getParameter("app") != null) {
    url = application.getRealPath("") + "/pags/apps/" + request.getParameter("app") + ".jsp";
    url2 = "pags/apps/" + request.getParameter("app") + ".jsp";

    File file = new File(url);
    if (file.exists()) {
%>
<jsp:include page="<%=url2%>"/>
<%
} else {
%>
<jsp:include page="pags/erro.jsp"/>
<%                }
} else {
    url = "pags/content.jsp";
%>
<jsp:include page="<%=url%>"/>
<%    }
%>
<jsp:include page="footer.jsp"/>
<%
    } else {
        out.println("<script>document.location.href='instalacao.jsp';</script>");
    }
%>